using System.IO;
using System.Linq;
using SolutionFactory.Services;

namespace SolutionFactory_console
{
	public class SourceBinDeleterFileVisitor : IFileVisitor
	{
		private readonly string _srcDir;
		private readonly string[] _dirs;

		public SourceBinDeleterFileVisitor(string srcDir, params string[] dirs)
		{
			_srcDir = srcDir;
			_dirs = dirs;
		}

		public void Visit(FileInfo file)
		{
			if(file.DirectoryName.Contains(_srcDir) && _dirs.Any(s => file.DirectoryName.Contains("\\"+s+"\\")))
			{
				file.Delete();
			}
		}
	}
}